<template>
  <div class="app-container">
    <div class="filterDiv">
      <el-checkbox v-model="listQuery.period" false-label="0" true-label="1" style="margin-right:10px">会计期间</el-checkbox>
      <el-checkbox v-model="listQuery.coa" false-label="0" true-label="1" style="margin-right:10px">同步系统新增科目</el-checkbox>
      <el-checkbox v-model="listQuery.coaN" false-label="0" true-label="1" style="margin-right:10px">同步系统科目名称</el-checkbox>
      <el-checkbox v-model="listQuery.coaCrdr" false-label="0" true-label="1" style="margin-right:10px">同步系统科目方向</el-checkbox>
      <el-checkbox v-model="listQuery.templet" false-label="0" true-label="1" style="margin-right:10px">同步凭证模板(系统)</el-checkbox>
      <el-button v-permiss="['742010']" size="small" type="primary" round @click="getData('0')">检查</el-button>
      <el-button v-permiss="['742010']" size="small" type="primary" round @click="getData('1')">执行同步</el-button>
    </div>
    <div class="contentDiv">
      <el-table v-loading="listLoading" :data="tableData" stripe fit resize empty-text="无同步数据" style="width: 100%;" size="small">
        <el-empty slot="empty" :image-size="120" description="无同步数据" />
        <el-table-column label="科目编码">
          <template slot-scope="{row}">
            <span>{{ row.coaCode }}</span>
          </template>
        </el-table-column>
        <el-table-column label="科目名称" align="center">
          <template slot-scope="{row}">
            <span>{{ row.coaName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="方向" align="center">
          <template slot-scope="{row}">
            <span>{{ row.crDrStr }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作类型" width="80">
          <template slot-scope="{row}">
            <span>{{ row.unchageableFlag == 1 ? '新增' : '编辑' }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import { synbasedata } from '@/api/user'
export default {
  name: 'SynBasedata',
  data() {
    return {
      listQuery: {
        coaHierarchyId: '',
        period: '1',
        coa: '1',
        coaN: '1',
        coaCrdr: '1',
        templet: '1'
      },
      listLoading: false,
      periodList: [],
      tableData: []
    }
  },
  mounted() {
    this.getData('0')
  },
  methods: {
    getData(type) {
      this.listQuery.isAutoCommit = type
      this.listLoading = true
      synbasedata(this.listQuery).then((res) => {
        this.listLoading = false
        if (res.data.errorCode !== '0') {
          this.$message.warning(res.data.msg)
        }
      })
    }
  }
}
</script>
<style scoped>
.label {
  font-size: 14px;
  margin-right: 5px;
  color: #333;
  margin-left: 10px;
}

.label:first-child {
  margin-left: 0;
}
</style>
